<template>
  <label class="switch">
    <input type="checkbox" @click="switchChange" />
    <span class="slider"></span>
  </label>
</template>

<script>
export default {
  data() {
    return {};
  },
  methods: {
    switchChange() {
      this.$emit("click");
    },
  },
};
</script>

<style lang="less">
/**
 * UIVerse 库的样式
 * 注意：这部分的样式是直接从 https://uiverse.io/victoryamaykin/funny-rabbit-33 复制过来的，
 * 这部分是 https://uiverse.io/victoryamaykin/funny-rabbit-33 三方库的直接引入
 */
.switch {
  position: relative;
  display: inline-block;
  width: 120px;
  height: 34px;
}

.switch input {
  display: none;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #242431;
  -webkit-transition: 0.4s;
  transition: 0.4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: 0.4s;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #0e6eb8;
}

input:focus + .slider {
  box-shadow: 0 0 1px #2196f3;
}

input:checked + .slider:before {
  -webkit-transform: translateX(26px);
  -ms-transform: translateX(26px);
  transform: translateX(85px);
}

/*------ ADDED CSS ---------*/
.slider:after {
  content: "表格";
  color: white;
  display: block;
  position: absolute;
  transform: translate(-50%, -50%);
  top: 50%;
  left: 50%;
  font-size: 14px;
  font-family: Verdana, sans-serif;
}

input:checked + .slider:after {
  content: "图表";
}

/*--------- END --------*/
</style>